<!DOCTYPE html>
<!--
  ~ This file is part of gorilla-repl. Copyright (C) 2014-, Jony Hudson.
  ~
  ~ gorilla-repl is licenced to you under the MIT licence. See the file LICENCE.txt for full details.
  -->

<html id="document">
<head>

    <link rel="shortcut icon" href="favicon.ico"/>

    <link href='http://fonts.googleapis.com/css?family=Arvo:400,700,400italic,700italic|Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <!--<link href='css/fonts.css' rel='stylesheet' type='text/css'/>-->
    <link rel="stylesheet" href="jslib/codemirror-4.5/lib/codemirror.css"/>
    <link rel="stylesheet" href="css/worksheet.css"/>
    <link rel="stylesheet" href="css/output.css"/>
    <link rel="stylesheet" href="css/viewer.css"/>

    <script type="text/javascript"
            src="http://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_SVG-full.js&delayStartupUntil=configured"></script>
    <script type="text/javascript" src="jslib/marked/marked.min.js"></script>
    <script type="text/javascript" src="jslib/codemirror-4.5/lib/codemirror.js"></script>
    <script type="text/javascript" src="jslib/codemirror-4.5/addon/runmode/runmode.js"></script>
    <script type="text/javascript" src="jslib/codemirror-4.5/addon/runmode/colorize.js"></script>
    <script type="text/javascript" src="jslib/codemirror-4.5/mode/clojure/clojure.js"></script>
    <script type="text/javascript" src="jslib/jquery/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="jslib/underscore/underscore.min.js"></script>
    <script type="text/javascript" src="jslib/knockoutjs/knockout-3.0.0.min.js"></script>
    <script type="text/javascript" src="jslib/d3/d3.v3.min.js"></script>
    <script type="text/javascript" src="jslib/d3/d3.geo.projection.min.js"></script>
    <script type="text/javascript" src="jslib/vega/vega.1.3.3.min.js"></script>
    <script type="text/javascript" src="jslib/uuid/uuid.core.js"></script>
    <script type="text/javascript" src="js/worksheetParser.js"></script>
    <script type="text/javascript" src="js/utils.js"></script>
    <script type="text/javascript" src="js/mathJaxViewer.js"></script>
    <script type="text/javascript" src="js/outputViewer.js"></script>
    <script type="text/javascript" src="js/renderer.js"></script>
    <script type="text/javascript" src="js-viewer/segment-viewer.js"></script>
    <script type="text/javascript" src="js-viewer/worksheet-viewer.js"></script>
    <script type="text/javascript" src="js-viewer/github.js"></script>
    <script type="text/javascript" src="js-viewer/bitbucket.js"></script>
    <script type="text/javascript" src="js-viewer/main-viewer.js"></script>

    <title data-bind="text: title">Gorilla REPL viewer</title>
</head>
<body>

<!-- The page stub -->
<div class="header">
    <div class="header-left">Made with <a href="http://clojure.org" target="_blank">Clojure</a> and
        <a href="http://gorilla-repl.org" target="_blank">Gorilla REPL</a></div>
    <div class="header-right">
        <a href="#" data-bind="click: showCopyBox">View this worksheet on <span data-bind="text: host"></span></a>
    </div>
</div>


<div id="contents" data-bind="css: {veiled: copyBoxVisible}">
    <div class="segment container-segment">
        <div class="container-children">
            <div data-bind="template: {name: 'segment-template', foreach: worksheet().segments()}">
            </div>
        </div>
    </div>
</div>

<div class="scroll-pad"></div>

<!-- Templates -->
<script type="text/html" id="segment-template">
    <div data-bind="template: {name: renderTemplate}"></div>
</script>

<script type="text/html" id="code-segment-template">
    <div class="segment code">

        <div class="segment-main">
            <pre class="static-code clojure"><code data-bind="text: contents"></code></pre>
        </div>
        <div class="error-text" data-bind="text: errorText, visible: errorText() !== ''"></div>
        <div class="console-text" data-bind="visible: consoleText() !== ''">
            <pre><code data-bind="html: consoleText"></code></pre>
        </div>
        <div class="output"
             data-bind="visible: (output() != ''), outputViewer: output, segmentID: id">
        </div>
        <div class="segment-footer"></div>
    </div>
</script>

<script type="text/html" id="free-segment-template">
    <div class="segment free">
        <div class="segment-main">
            <div class="free-preview" data-bind="mathJaxViewer: renderedContent"></div>
        </div>
        <div class="segment-footer"></div>
    </div>
</script>

<!-- Copying instructions -->
<div class="copyBox" style="display: none" data-bind="visible: copyBoxVisible">
    <p>This code can be found on <span data-bind="text: host"></span> here:</p>
    <div data-bind="visible: (!(source().toLowerCase() === 'gist'))">
        <a data-bind="attr: {href: sourceURL}, text: sourceURL" target="_blank"></a>
        </div>
    <div data-bind="visible: (source().toLowerCase() === 'gist')">
        <a data-bind="attr: {href: sourceURL}, text: sourceURL" target="_blank"></a>
    </div>

    <p>You can run and edit your own copy of this worksheet in under five minutes, even if you've never used
    Clojure or Gorilla REPL before:</p>
    <div data-bind="visible: (!(source().toLowerCase() === 'gist'))">
    <ul>
        <li>If you don't yet have Leiningen installed, then follow the instructions
            <a href="http://leiningen.org/#install" target="_blank">here</a>. It only takes a couple of minutes.</li>
        <li>Clone the <span data-bind="text: host"></span>  project that contains this worksheet:
            <a data-bind="attr: {href: sourceURL}, text: sourceURL" target="_blank"></a>.</li>
        <li>Open a terminal in the project directory and run "lein gorilla".</li>
        <li>Open the load dialog by pressing "alt+g alt+l" ("ctrl+g ctrl+l" on Mac).</li>
        <li>Enter the path "<span data-bind="text: filename"></span>" into the dialog.</li>
    </ul>
    </div>
    <div data-bind="visible: (source().toLowerCase() === 'gist')">
        <ul>
            <li>If you don't have Gorilla REPL installed yet, then follow the instructions
                <a href="http://gorilla-repl.org/start.html" target="_blank">here</a>.
            </li>
            <li>Download the worksheet from the GitHub gist:
                <a data-bind="attr: {href: sourceURL}, text: sourceURL" target="_blank"></a>.</li>
            <li>Assuming you've added the Gorilla plugin to your "profiles.clj", as described in the getting started
                instructions from step one, then run "lein gorilla"</li>
            <li>Open the load dialog by pressing "alt+g alt+l" ("ctrl+g ctrl+l" on Mac).</li>
            <li>Enter the path to the file you saved in step two.</li>
        </ul>
    </div>
    <p>That's it, you're done. Have fun!</p>
    <div class="button" data-bind="click: hideCopyBox">OK, got it</div>
</div>

</body>
<script>
    (function(){
        var t,i,e,n=window,o=document,a=arguments,s="script",r=["config","track","identify","visit","push","call","trackForm","trackClick"],c=function(){var t,i=this;for(i._e=[],t=0;r.length>t;t++)(function(t){i[t]=function(){return i._e.push([t].concat(Array.prototype.slice.call(arguments,0))),i}})(r[t])};for(n._w=n._w||{},t=0;a.length>t;t++)n._w[a[t]]=n[a[t]]=n[a[t]]||new c;i=o.createElement(s),i.async=1,i.src="//static.woopra.com/js/t/5.js",e=o.getElementsByTagName(s)[0],e.parentNode.insertBefore(i,e)
    })("woopra");

    woopra.config({
        domain: 'gorilla-repl.org'
    });
    woopra.track();
</script>
</html>
